/*
 * @# DataGenerator.java 2011-11-7 下午04:45:50
 * 
 * Copyright (C) 2010 - 2011 广州羿安信息科技有限公司
 * Guangzhou ianswer information technology co. ltd.
 * 
 * All rights reserved!
 */
package com.ianswer.experiments.redis;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.ianswer.common.orm.PublicDao;

/**
 * @author alvin hwang
 */
public class DataGenerator {

	private static final int COUNT = 10000;
	
	public static void main(String[] args) {
		Logger log = LoggerFactory.getLogger(DataGenerator.class);
		
		log.debug("start insert datas ...");
		
		PublicDao publicDao = DataUtils.getBean("publicDao", PublicDao.class);
		
		for (int i = 1000; i < COUNT; i++) {
			RedisDemo data = new RedisDemo();
			data.setName("测试名称" + i);
			data.setDescription(" 除了为宣传新唱片《是时候》而短暂出现在公众视野中，" +
					"已为人妻的孙燕姿已经低调得有些销声匿迹。" +
					"但事实上，换上服装设计师身份的燕姿一直在忙碌着，" +
					"这次来到上海为自己设计的新款春夏装做宣传，" +
					"记者才有机会向她了解她的婚后生活以及近况。");
			data.setAge(i);
			
			publicDao.insert("redisDemo.insert", data);
		}
		
		log.debug("done insert datas ...");
	}
}
